package com.example.Laboratory.Mapper;


import com.example.Laboratory.Entity.Contact;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ContactMapper {

    //增加联系我们
    @Insert("INSERT INTO contact (contact_name, contact_address, contact_postcode, contact_telephone,contact_email)" +
            " VALUES(#{contact_name},#{contact_address},#{contact_postcode},#{contact_telephone},#{contact_email})")
    int addContact (Contact t);

    //查找联系我们
    @Select("SELECT * FROM contact")
    List<Contact> selectContact ();

    //删除联系我们
    @Delete("DELETE FROM contact WHERE contact_id=#{contact_id}")
    int deleteContact (int contact_id);

    //修改联系我们
    @Update("UPDATE contact SET contact_name=#{contact_name},contact_address=#{contact_address},contact_postcode=#{contact_postcode}," +
            "contact_telephone=#{contact_telephone},contact_email=#{contact_email} WHERE contact_id=#{contact_id}")
    int updateContact(Contact t);
}
